<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<script type="text/javascript">
$(function(){
	$("#send_method").change(function(){
		if ($(this).val()=="<?=Q::ini('custom_flag/sales_order_send_method/resend/value')?>")
		{
			$("#resend_reason,#resend_sales_order_id").show();
		}
		else
		{
			$("#resend_reason,#resend_sales_order_id").hide();
		}
	});
	$("#send_method").change();
	$("#sales_time").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
});
</script>
<h2>修改销售订单信息</h2>
<form action="<?=url('Sales::Order/OrderInfoEditSave')?>" method="post">
<table width="100%" class="form_table">
	<tr>
		<th>本地单号</th>
		<td><?=$sales_order['number']?><input type="hidden" name="id" value="<?=$sales_order['id']?>" /></td>
		<th>网站单号</th>
		<td><?=$sales_order['shop_order_number']?></td>
	</tr>
	<tr>
		<th>网站/店铺</th>
		<td><?=$sales_order['shop_name']?></td>
		<th>支付方式</th>
		<td>
			<select name="payment_method">
			<?foreach (Q::ini('custom_flag/sales_order_payment_method') as $pm):?>
			<option value="<?=$pm['value']?>" <?if ($pm['value'] == $sales_order['payment_method'])echo "selected='selected'"?> ><?=$pm['name']?></option>
			<?endforeach;?>
			</select>
		</td>
	</tr>
	<tr>
		<th>邮寄方式</th>
		<td>
			<select name="shipping_method">
				<?foreach ($shipping_method as $sm):?>
				<option value="<?=$sm['id']?>" <?if ($sm['id'] == $sales_order['shipping_method'])echo "selected='selected'"?>><?=$sm['name']?></option>
				<?endforeach;?>
			</select>
		</td>
		<th>发货类型</th>
		<td>
			<select name="send_method"  id="send_method">
				<?foreach (Q::ini('custom_flag/sales_order_send_method') as $sm):?>
				<option value="<?=$sm['value']?>" <?if ($sm['value'] == $sales_order['send_method'])echo "selected='selected'"?>><?=$sm['name']?></option>
				<?endforeach;?>
			</select>
			<select name="resend_reason" id="resend_reason" style="display:none;">
			<?foreach (Q::ini('custom_flag/sales_order_resend_reason') as $rr):?>
			<option value="<?=$rr['value']?>" <?if ($rr['value'] == $sales_order['resend_reason'])echo "selected='selected'"?>><?=$rr['name']?></option>
			<?endforeach;?>
			</select>
			<input type="text" size="13" id="resend_sales_order_id" style="display:none;" name="resend_sales_order_id" value="<?=$sales_order['resend_sales_order_id']?>" />
		</td>
	</tr>
	<tr>
		<th>币种</th>
		<td>
			<select name="currency_id">
				<option value="">请选择..</option>
				<?foreach ($currency as $c):?>
				<option value="<?=$c['id']?>" <?if(isset($sales_order)&&$sales_order['currency_id']==$c['id'])echo "selected='selected'";?>><?=$c['code']?></option>
				<?endforeach;?>
			</select>
		</td>
	</tr>
	<tr>
		<th>交易号</th>
		<td><input type="text" name="transaction_id" value="<?=$sales_order['transaction_id']?>"/></td>
		<th>销售日期</th>
		<td><input type="text" name="sales_time" id="sales_time" value="<?=$sales_order['sales_time']?>"></td>
	</tr>
	<tr>
		<th>买家ID</th>
		<td><input type="text" name="shop_buyer_id" value="<?=$customer['shop_buyer_id']?>" /></td>
		<th>买家全名</th>
		<td><input type="text" name="fullname" value="<?=$customer['fullname']?>" /></td>
	</tr>
	<tr>
		<th>买家电话</th>
		<td><input type="text" name="phone" value="<?=$customer['phone']?>" /></td>
		<th>买家Email</th>
		<td><input type="text" name="email" value="<?=$customer['email']?>"/></td>
	</tr>
	<tr>
		<th>收货地址1</th>
		<td><input type="text" name="street1" value="<?=htmlspecialchars($customer['street1'])?>" /></td>
		<th>收货地址2</th>
		<td><input type="text" name="street2" value="<?=htmlspecialchars($customer['street2'])?>" /></td>
	</tr>
	<tr>
		<th>所在城市</th>
		<td><input type="text" name="city" value="<?=$customer['city']?>" /></td>
		<th>所在州/省</th>
		<td><input type="text" name="state" value="<?=$customer['state']?>" /></td>
	</tr>
	<tr>
		<th>所在国家</th>
		<td><input type="text" name="country" value="<?=$customer['country']?>" /></td>
		<th>所在国家(中文)</th>
		<td><input type="text" name="country_cn" value="<?=$customer['country_cn']?>" /></td>
	</tr>
	<tr>
		<th>邮编编码</th>
		<td><input type="text" name="zip" value="<?=$customer['zip']?>" /></td>
		<th>运费</th>
		<td><input type="text" name="shipping_fee" value="<?=sprintf('%.2f', $sales_order['shipping_fee'])?>" /></td>
	</tr>
	<tr>
		<th>折扣</th>
		<td><input type="text" name="discount" value="<?=sprintf('%.2f', $sales_order['discount'])?>" /></td>
		<th>地址备注</th>
		<td colspan="3"><input type="text" name="address_notes" size="50" value="<?=htmlspecialchars($customer['address_notes'])?>" /></td>
	</tr>
	<tr>
		<td><input type="hidden" name="history" value="<?=isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:url('sales::order/list')?>" /></td>
		<td><input type="submit" class="button" value="修改保存" /></td>
	</tr>
</table>
</form>
<?php $this->_endblock(); ?>